home *** CD-ROM | disk | FTP | other *** search
- # CVS $Id: form.tcl,v 1.3 1995/02/03 16:54:44 zibi Exp $
- #
- # This is a test for the options to a form dialog
- # @(#) form.tcl 11.12 95/01/31
-
- source tools.tcl
-
- global count
- set count 0
-
- proc doQuitCB {cbs} {
- VtClose
- exit 0
- }
-
- proc closeCB {parent cbs} {
-
- VtHide $parent
- }
-
- proc makeTransCB {cbs} {
- global ap
-
- set parent [lindex $cbs 0]
-
- set $ap $parent
- }
-
- proc doModalCB {modeless cbs} {
- global ap
- global lastModal
-
- set parent [lindex $cbs 0]
- echo $parent
- if {$modeless} {
- set fn [VtFormDialog $parent.fn -title "Modeless Dialog" -modeless ]
- # VtSetValues $fn -transientFor $lastModal
- VtSetValues $fn -windowGroup ""
- VtSetValues $fn -modeless
- } else {
- set fn [VtFormDialog $parent.fn -title "Modal Dialog" ]
- # VtSetValues $fn -transientFor $ap
- set lastModal $fn
- }
-
- # VtSetValues $fn -windowGroup $ap
-
-
- set rc [VtRowColumn $fn.rc]
- VtPushButton $rc.modal -label "Modal" -callback "doModalCB 0"
- VtPushButton $rc.modeless -label "Modeless" -callback "doModalCB 1"
- VtPushButton $rc.close -callback "closeCB $fn"
- VtPushButton $rc.trans -callback makeTransCB
- VtShow $fn
- }
-
- proc doShowOnCB { cbs} {
- set parent [lindex $cbs 0]
-
- set fn [VtFormDialog $parent.fn -title "Show on" -hidden false ]
-
-
- set lab [VtLabel $fn.lab -label "You should see me growing"]
- set rc [VtRowColumn $fn.rc -below $lab]
- VtPushButton $rc.modal -label "Modal" -callback "doModalCB 0"
- VtPushButton $rc.modeless -label "Modeless" -callback "doModalCB 1"
- VtPushButton $rc.close -callback "closeCB $fn "
- VtShow $fn
- }
-
- proc doResizeCB {cbs} {
- set parent [lindex $cbs 0]
-
- set fn [VtFormDialog $parent.fn -title "Resizable" \
- -okCallback CloseDialogCB \
- ]
-
-
- VtToggleButton $fn.tog -label Resizable -value 1 \
- -callback "toggleCB $fn"
- VtPushButton $fn.addbutton -callback "addButton $fn" -label "Add Label"
- VtPushButton $fn.delbutton -callback "delButton $fn" -label "Delete Label"
-
- VtShowDialog $fn
-
- }
-
- proc toggleCB {fn cbs} {
-
- set toggled [keylget cbs set]
-
- if { $toggled } {
- VtSetValues $fn -resizable true
- } else {
- VtSetValues $fn -resizable false
- }
-
- }
-
- proc delButton {fn cbs} {
-
- global count
-
- if { $count } {
- VtDestroy $fn.lab$count
- set count [expr $count - 1]
- }
- }
-
- proc addButton {fn cbs} {
-
- global count
-
- set count [expr $count + 1]
-
- VtLabel $fn.lab$count -label "New Label"
- }
-
- proc doButtonsCB {cbs} {
- set parent [lindex $cbs 0]
-
- set fn [VtFormDialog $parent.fn -title "Buttons" \
- -okCallback CloseDialogCB \
- -apply \
- -cancel \
- -reset \
- -help \
- ]
-
-
- set lab [VtLabel $fn.lab -label "You should see a button below"]
-
- VtShowDialog $fn
- }
-
- proc mkDecorDlogCB {cbs} {
- set dlog [keylget cbs dialog]
- set list [GetDialogKey $dlog list]
-
- set decor [VtListGetSelectedItem $list -byItemList]
-
- VtMessageDialog $dlog.me -message "Check out my decorations"\
- -wmDecoration $decor -hidden 0
-
- set fd [VtFormDialog $dlog.form -okCallback CloseDialogCB \
- -wmDecoration $decor ]
-
- VtLabel $fd.lab -label "Check out the FormDialog's decors"
- VtShow $fd
- }
-
- proc doDecorationCB {cbs} {
- set target [keylget cbs widget]
-
- set dlog [VtFormDialog $target.form \
- -okLabel "Make Dialog" -okCallback mkDecorDlogCB \
- -cancelCallback CloseDialogCB \
- -wmDecoration {TITLE BORDER}]
-
- set decor {ALL RESIZE TITLE BORDER MENU}
-
- set lst [VtList $dlog.lst -itemList $decor \
- -rightSide FORM -bottomSide FORM -rows 5 \
- -selection MULTIPLE ]
-
-
- SetDialogKey $dlog list $lst
-
- VtShow $dlog
- }
-
- proc doHorizontalOffsetCB { cbs} {
-
- }
-
- global ap
-
- set ap [VtOpen ClassName]
-
- set fn [VtFormDialog $ap.test -wmDecoration {TITLE BORDER MINIMIZE} ]
-
- set rc [VtRowColumn $fn.rc \
- -numColumns 2 \
- -xmArgs "XmNbackground pink" ]
-
- set actions { { "Modal Dialog" "doModalCB 0" }
- { "Modeless Dialog" "doModalCB 1" }
- { "Totally Modeless Dialog" "doModalCB 2" }
- { "Decorations Dialog" doDecorationCB }
- { "horizontalOffset" doHorizontalOffsetCB }
- { "showOnCB" doShowOnCB }
- { "Buttons" doButtonsCB }
- { "Resizable" doResizeCB }
- { "Quit" doQuitCB }
- }
-
- foreach i $actions {
- set label [lindex $i 0]
- set cb [lindex $i 1]
- VtPushButton $rc.$label -callback $cb
- }
-
- VtShow $fn
-
- VtMainLoop
-